home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
dviware
/
dvi2pcl
/
cachefonts.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-24
|
4KB
|
105 lines
/* $Log: cachefonts.c,v $
* Revision 0.8 92/11/23 19:46:37 19:46:37 bt (Bo Thide')
* Fixed resolution bug. Portable downloading. Added/changed options. PJXL color support
*
* Revision 0.7 92/11/13 02:41:21 02:41:21 bt (Bo Thide')
* More bug fixes and improvements. Support for PaintJet XL
*
* Revision 0.6 92/11/10 21:47:37 21:47:37 bt (Bo Thide')
* Bug fixes. Added -R option. Better font handling.
*
* Revision 0.5 92/11/09 16:25:24 16:25:24 bt (Bo Thide')
* Rewrite of dospecial.c. Extended \special support
*
* Revision 0.4 92/11/08 02:45:39 02:45:39 bt (Bo Thide')
* Changed to portable bit manipulations. Replaced strrstr for non-POSIX
* compliant C. Fixed numerous bugs. Added support for more \special's.
*
* Revision 0.3 92/08/24 12:45:32 12:45:32 bt (Bo Thide')
* Fixed 8 bit (dc font) support.
*
* Revision 0.2 92/08/23 17:28:54 17:28:54 bt (Bo Thide')
* Source cleaned up. Changed certain function calls. Removed globals.
*
* Revision 0.1 92/08/22 23:58:47 23:58:47 bt (Bo Thide')
* First Release.
* */
/*
* This is the procedure with caching font responsibility. On entrance to
* this procedure, all the font usage information will have been loaded into
* 'use_count' entries for each font. 'cachefonts' first checks which of the
* fonts, used in the .dvi file, are permanently downloaded by calling
* 'permfonts' which in turn returns the number of permanent downloaded fonts.
* The remaining fonts are ordered in 'fontlist' in respect to their usage by
* calling 'sortfonts' which in turn returns the number of remaining fonts
* used in the document. These fonts will be downloaded in order of their
* usage, those most heavily used comes first and with just the characters
* used from these fonts. The downloading process continues so long the
* printer's memory will allow more and the actual number of downloaded fonts
* doesn't exceed MAXDOWN. If there are fonts which can't be download
* anymore, their character's pixel patterns together with a small font and
* character overhead are stored dynamically in memory.
*/
#include <stdio.h>
#include "globals.h"
#include "pcl.h"
static char rcsid[] = "$Header: cachefonts.c,v 0.8 92/11/23 19:46:37 bt Exp $";
void cachefonts(bitfile, resfile, maxdown, device)
FILE *bitfile;
FILE *resfile;
short maxdown;
short device;
{
int f;
int n;
int actfontsdown;
int permfontsdown;
int fontnum;
int fontlist[MAXFONTS];
/* Find all permanent downloaded fonts for dvifile in progress */
actfontsdown = permfontsdown = permfonts(resfile);
/* Sort additional fonts in respect to their usage */
fontnum = sortfonts(fontlist);
/* Decide for downloading or storage of fonts and chars and do it */
for(n = 0 ; n < fontnum ; n++) {
f = fontlist[n];
font = fontptr[f];
cbase = font->chr;
loadpkfile();
makepkdir();
convtfm = (double)font->scaled_size/(double)FIX ;
convpxl = (double)font->design_size/65536.0*
(double)font->dir_size/(double)SCALE;
#ifdef DEBUG
fprintf(stderr,"cachefonts: font->scaled_size = %d\n", font->scaled_size);
fprintf(stderr,"cachefonts: font->design_size = %d\n", font->design_size);
fprintf(stderr,"cachefonts: font->dir_size = %d\n", font->dir_size);
fprintf(stderr,"cachefonts: convtfm = %g, convpxl = %g\n", convtfm, convpxl);
#endif /* DEBUG */
if(actfontsdown >= maxdown ||
(printer.mem-printermem_used) < MINPRINTERMEM)
storefont(bitfile, f);
else {
printermem_used += downloadfont(bitfile,
permfontsdown, device);
actfontsdown++;
}
}
if(landscape)
(void)fputs(PCL4_LANDSCAPE,bitfile);
if(manualfeed)
(void)fputs(PCL4_MANUAL_FEED,bitfile);
}